package jgl.vajra.operator.part.login.viewModel;

import java.util.Map;

import jgl.vajra.operator.part.login.contract.UnboundMachineBossContract;
import jgl.vajra.operator.part.login.model.UnboundMachineBossModel;
import jgl.vajra.operator.widget.mvvm.factory.CreateModel;
import jgl.vajra.operator.widget.retrofithelper.rxsubscriber.ProgressObserver;
import jgl.vajra.operator.widget.utils.ToastUtils;

@CreateModel(UnboundMachineBossModel.class)
public class UnboundMachineBossViewModel extends UnboundMachineBossContract.ViewModel{
    @Override
    public void bindMachineData(Map<String, Object> map) {
        mModel.bindMachineData(map).subscribe(new ProgressObserver<Object>(true, null) {
            @Override
            public void _onNext(Object secretKey) {
                mView.returnBindMachineData();
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
                ToastUtils.showShort("解绑失败");
            }
        });
    }
}
